﻿using Fee.Orders;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Fee.Mapping.Orders
{
    public class DelegateOrderDetailMapping : IEntityTypeConfiguration<DelegateOrderDetail>
    {
        public void Configure(EntityTypeBuilder<DelegateOrderDetail> builder)
        {
            builder.HasKey(_ => _.Id);
            builder.Property(_ => _.Id).ValueGeneratedOnAdd();

            builder.Property(_ => _.ContractType);

            builder.Property(_ => _.ConstructionType);

            builder.HasOne(_ => _.Contract).WithMany().HasConstraintName("FK_contract_fwContract_ID");

            builder.HasOne(_ => _.Project).WithMany().HasConstraintName("FK_delegOrd_Prj_ID");
            builder.Property(f => f.SourceConstructionDetailId);
            builder.Property(f => f.Operator);
        
            builder.ToTable("fee_DelegateOrderDetail");
        }
    }
}